<template>
	<view class="xiangqing">
		<view class="header">
			<view class="title">{{content.title}}</view>
			<view class="time">{{content.created_at}}</view>
		</view>
		<view class="html" @click="getImage()">
			<view v-html="content.content"></view>
		</view>
	</view>
</template>

<script>
		import $ from '@/common/jquery-1.10.2.min.js'	
		import uParse from '@/components/gaoyia-parse/parse.vue'
		export default {
		components: {
			uParse
		},
		data(){
			return{
				content: [],
				id:0
			}
		},
		onLoad(param) {
			this.id=param.id;
			this.getcontent(this.id);
			uni.setNavigationBarTitle({
			    title: '详情'
			});
			this.getImage()
		},
		methods:{
			getImage() {
				let imgs = [];
				let imgObj = $(".html").find("img");
				let l=imgObj.length;
				// 遍历获取url
				for (let i = 0; i < l; i++) {
					imgs.push(imgObj[i].src);
					imgObj[i].onclick = function () {
						let nowImgurl = this.src;
					}
				}
			},
			preview(src, e) {
			  // do something
			},
			navigate(href, e) {
			  // do something
			},
			//获取单页内容
			getcontent(id){
				var that=this
				this.$http.get('system/getNewsById',{'id':id}).
				then(function (response) {
					that.content = response.data;
				}).catch(function (error) {
					console.log(error);
				});
			}
		}
	}
</script>
<style>
	>>> img{
		max-width: 100%;
	}
</style>
<style scoped lang="scss">
	.xiangqing{
		padding: 0 25rpx 100rpx;
		.header{
			padding-bottom: 33rpx;
			border-bottom: 1px solid #c6c6c6;
			.title{
				padding: 40rpx 0;
				line-height: 50rpx;
				font-size: 38rpx;
				color: #000000;
			}
			.time{
				font-size: 26rpx;
				color: #7b7b7b;
			}
		}
		.html1{
			padding: 30rpx 0 40rpx;
		}
		.html{
			width: 700rpx;
			font-size: 28rpx;
			color: #000000;
			line-height: 50rpx;
			text-align: justify;
		}
	}
</style>
